#pragma once
#include "vector3.h"


#define TEMPLATE template<typename T>
#define VECTOR3 Vector3T<T> 

BEGIN_NAMESPACE_OXGE

TEMPLATE
const VECTOR3 VECTOR3::ZERO(0,0,0);

TEMPLATE
const VECTOR3 VECTOR3::UNIT_X(1,0,0);

TEMPLATE
const VECTOR3 VECTOR3::UNIT_Y(0,1,0);

TEMPLATE 
const VECTOR3 VECTOR3::UNIT_Z(0,0,1);

TEMPLATE
const VECTOR3 VECTOR3::UNIT_SCALE(1,1,1);


TEMPLATE
std::ostream& operator<<(std::ostream& os, const VECTOR3& vec)
{
	os << "(";
	size_t i = 0;
	for(;i<vec.NLen-1;++i)
	{
		os << vec[i] << ',';
	}
	os << vec[i] ;
	os << ")";
	return os;
}

//UnitTest
TEMPLATE
void VECTOR3::UnitTest()
{
	T cvArray[] = { 1,2,3,4,5,6,7 }; 
	VectorType vec;
	VectorType vec1(1,2,3);
	VectorType vec2(cvArray);

	vec *= 2;
	vec2 += vec1;
	vec2 -= vec1;
	vec1 + vec2;
	vec1 - vec2; 
	vec1 * 2;
	2 * vec1;

	vec[2];
	vec1.dot(vec2);
	vec1.cross(vec2);

	vec.Normalize();
	vec.SquareLength();
	vec.Length();

	vec = UNIT_X;
	vec = UNIT_SCALE;
	vec = UNIT_Y;
	vec = UNIT_Z;
	vec = ZERO;
}


END_NAMESPACE_OXGE

#undef TEMPLATE
#undef VECTOR3